package com.example.android.BluetoothChat;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.content.Intent;
import android.app.AlertDialog;
import android.content.DialogInterface;
//import android.util.Log;
public class welcome extends Activity {
	private Button b0; //= (Button)findViewById(R.id.mbutton00);
	private Button b1; //= (Button)findViewById(R.id.mbutton01);
	private Button b2; //= (Button)findViewById(R.id.mbutton02);
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	//Log.println(BIND_AUTO_CREATE, ACCOUNT_SERVICE, "here");
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.main);
    	b0 = (Button)findViewById(R.id.mbutton00);
    	b1 = (Button)findViewById(R.id.mbutton01);
    	b2 = (Button)findViewById(R.id.mbutton02);
        b0.setOnClickListener(new Button.OnClickListener()
        {
        	@Override
        	public void onClick(View v)
        	{
        		//jumpToLayout2();
        		Intent intent = new Intent();
        		intent.setClass(welcome.this, selection.class);
        		startActivity(intent);
        		welcome.this.finish();
        	}
        }
        );
        b1.setOnClickListener(new Button.OnClickListener()
        {
        	@Override
        	public void onClick(View v)
        	{
        		openOptionsDialog1();
        	}
        }
        );
        b2.setOnClickListener(new Button.OnClickListener()
        {
        	@Override
        	public void onClick(View v)
        	{
        		openOptionsDialog2();
        	}
        }
        );
    }
    private void openOptionsDialog1(){
    	new AlertDialog.Builder(this)
    	.setTitle(R.string.app_about)
    	.setMessage(R.string.app_about_msg)
    	.setPositiveButton(R.string.str_ok,
    			new DialogInterface.OnClickListener(){
    				public void onClick(DialogInterface dialoginterface, int i){}
    			}
    	).show();
    }
    private void openOptionsDialog2(){
    	new AlertDialog.Builder(this)
    	.setTitle(R.string.app_exit)
    	.setMessage(R.string.app_exit_msg)
    	.setNegativeButton(R.string.str_no,
    			new DialogInterface.OnClickListener(){
    				public void onClick(DialogInterface dialoginterface, int i){}
    			}
    	)
    	.setPositiveButton(R.string.str_ok,
    			new DialogInterface.OnClickListener(){
    				public void onClick(DialogInterface dialoginterface, int i){
    					finish();
    				}
    			}
    	).show();
    }
    public void jumpToLayout2(){
    	setContentView(R.layout.mylayout1);
    	Button b = (Button) findViewById(R.id.mbutton00);
    	b.setOnClickListener(new Button.OnClickListener(){
    		@Override
    		public void onClick(View v){
    			jumpToLayout1();
    		}
    	});
    }
    public void jumpToLayout1(){
    	setContentView(R.layout.main);
    	Button b = (Button) findViewById(R.id.mbutton10);
    	b.setOnClickListener(new Button.OnClickListener(){
    		@Override
    		public void onClick(View v){
    			jumpToLayout2();
    		}
    	});
    }

}
